from pydantic import BaseModel
from typing import Optional
from datetime import datetime

class MCPServiceBase(BaseModel):
    name: str
    description: Optional[str] = None
    service_type: str
    config: str

class MCPServiceCreate(MCPServiceBase):
    knowledge_base_id: int

class MCPServiceUpdate(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None
    service_type: Optional[str] = None
    config: Optional[str] = None
    is_active: Optional[bool] = None

class MCPServiceResponse(MCPServiceBase):
    id: int
    knowledge_base_id: int
    is_active: bool
    created_at: datetime
    updated_at: Optional[datetime] = None
    
    class Config:
        from_attributes = True